package com.wikidot.designpatterns.composite.example1;

/**
 * Represents composite node.
 */
public class AdministrativeArea extends AdministrativeUnit {

	public AdministrativeArea(String areaName, String locationCode) {
		super(areaName, locationCode);
	}

	@Override
	public String getLocationInformation() {
		StringBuilder sb = new StringBuilder();
		if (this.parentUnit == null) {
			sb.append(this.locationCode);
		} else {
			sb.append(this.parentUnit.getLocationInformation());
			sb.append(".");
			sb.append(this.locationCode);
		}
		return sb.toString();
	}

	@Override
	public String unitNameLabel() {
		return "Structured administrative area \"" + this.unitName + "\"";
	}

}
